#include <stdlib.h>
#include <stdio.h>

#include "ldk_learn_jni_StringJni.h"

JNIEXPORT
void JNICALL Java_ldk_learn_jni_StringJni_passJavaString(JNIEnv *env, jclass clazz, jstring msg){
	const char* msg_pointer = (*env)->GetStringUTFChars(env, msg, JNI_FALSE);
	printf("[native_layer]: received: %s\n", msg_pointer);
	fflush(stdout);
	(*env)->ReleaseStringUTFChars(env, msg, msg_pointer);
	msg_pointer = NULL;
}

JNIEXPORT
jstring JNICALL Java_ldk_learn_jni_StringJni_generateString(JNIEnv *env, jclass clazz){
	jstring result = (*env)->NewStringUTF(env, "FROM Native， myName is 梁");
	return result;
}

